TASK #1: PROJECT OVERVIEW

image.png

image.png

TASK #2: IMPORT DATASETS AND LIBRARIES

In [1]:
In [3]:
Out[3]:
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
0 1 Finland 7.769 1.340 1.587 0.986 0.596 0.153 0.393
1 2 Denmark 7.600 1.383 1.573 0.996 0.592 0.252 0.410
2 3 Norway 7.554 1.488 1.582 1.028 0.603 0.271 0.341
3 4 Iceland 7.494 1.380 1.624 1.026 0.591 0.354 0.118
4 5 Netherlands 7.488 1.396 1.522 0.999 0.557 0.322 0.298
... ... ... ... ... ... ... ... ... ...
151 152 Rwanda 3.334 0.359 0.711 0.614 0.555 0.217 0.411
152 153 Tanzania 3.231 0.476 0.885 0.499 0.417 0.276 0.147
153 154 Afghanistan 3.203 0.350 0.517 0.361 0.000 0.158 0.025
154 155 Central African Republic 3.083 0.026 0.000 0.105 0.225 0.235 0.035
155 156 South Sudan 2.853 0.306 0.575 0.295 0.010 0.202 0.091

156 rows × 9 columns

In [7]:
Out[7]:
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
0 1 Finland 7.769 1.340 1.587 0.986 0.596 0.153 0.393
1 2 Denmark 7.600 1.383 1.573 0.996 0.592 0.252 0.410
2 3 Norway 7.554 1.488 1.582 1.028 0.603 0.271 0.341
3 4 Iceland 7.494 1.380 1.624 1.026 0.591 0.354 0.118
4 5 Netherlands 7.488 1.396 1.522 0.999 0.557 0.322 0.298
In [8]:
Out[8]:
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
148 149 Syria 3.462 0.619 0.378 0.440 0.013 0.331 0.141
149 150 Malawi 3.410 0.191 0.560 0.495 0.443 0.218 0.089
150 151 Yemen 3.380 0.287 1.163 0.463 0.143 0.108 0.077
151 152 Rwanda 3.334 0.359 0.711 0.614 0.555 0.217 0.411
152 153 Tanzania 3.231 0.476 0.885 0.499 0.417 0.276 0.147
153 154 Afghanistan 3.203 0.350 0.517 0.361 0.000 0.158 0.025
154 155 Central African Republic 3.083 0.026 0.000 0.105 0.225 0.235 0.035
155 156 South Sudan 2.853 0.306 0.575 0.295 0.010 0.202 0.091

PRACTICE OPPORTUNITY #1 [OPTIONAL]:

  • Select 2 countries from the dataframe and explore scores. Perform sanity check.
In [13]:
Out[13]:
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
8 9 Canada 7.278 1.365 1.505 1.039 0.584 0.285 0.308
In [14]:
Out[14]:
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
148 149 Syria 3.462 0.619 0.378 0.44 0.013 0.331 0.141

TASK #3: PERFORM EXPLORATORY DATA ANALYSIS

In [15]:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 156 entries, 0 to 155
Data columns (total 9 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Overall rank                  156 non-null    int64  
 1   Country or region             156 non-null    object 
 2   Score                         156 non-null    float64
 3   GDP per capita                156 non-null    float64
 4   Social support                156 non-null    float64
 5   Healthy life expectancy       156 non-null    float64
 6   Freedom to make life choices  156 non-null    float64
 7   Generosity                    156 non-null    float64
 8   Perceptions of corruption     156 non-null    float64
dtypes: float64(7), int64(1), object(1)
memory usage: 11.1+ KB
In [16]:
Out[16]:
Overall rank                    0
Country or region               0
Score                           0
GDP per capita                  0
Social support                  0
Healthy life expectancy         0
Freedom to make life choices    0
Generosity                      0
Perceptions of corruption       0
dtype: int64
In [17]:
Out[17]:
Overall rank Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
count 156.000000 156.000000 156.000000 156.000000 156.000000 156.000000 156.000000 156.000000
mean 78.500000 5.407096 0.905147 1.208814 0.725244 0.392571 0.184846 0.110603
std 45.177428 1.113120 0.398389 0.299191 0.242124 0.143289 0.095254 0.094538
min 1.000000 2.853000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 39.750000 4.544500 0.602750 1.055750 0.547750 0.308000 0.108750 0.047000
50% 78.500000 5.379500 0.960000 1.271500 0.789000 0.417000 0.177500 0.085500
75% 117.250000 6.184500 1.232500 1.452500 0.881750 0.507250 0.248250 0.141250
max 156.000000 7.769000 1.684000 1.624000 1.141000 0.631000 0.566000 0.453000
In [18]:
Out[18]:
0

PRACTICE OPPORTUNITY #2 [OPTIONAL]:

  • Which country has the maximum happiness score? What is the perception of corruption in this country?
In [20]:
Out[20]:
7.769
In [21]:
Out[21]:
Overall rank Country or region Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
0 1 Finland 7.769 1.34 1.587 0.986 0.596 0.153 0.393

TASK #4: PERFORM DATA VISUALIZATION: PAIRPLOT & SCATTERMATRIX

In [110]:
46800.511.500.511.500.5100.20.40.600.20.40.646800.10.20.30.400.511.500.511.500.5100.20.40.600.20.40.600.20.4
ScoreGDP per capitaSocial supportHealthy life expectancyFreedom to make life choicesGenerosityPerceptions of corruptionScoreGDP per capitaSocial supportHealthy life expectancyFreedom to make life choicesGenerosityPerceptions of corruption
In [5]:
Out[5]:
<seaborn.axisgrid.PairGrid at 0x2000bfaae10>
<Figure size 1440x1440 with 0 Axes>

TASK #5: PERFORM DATA VISUALIZATION: DISTPLOT & CORRELATION MATRIX

In [7]:
In [9]:
Out[9]:
Overall rank Score GDP per capita Social support Healthy life expectancy Freedom to make life choices Generosity Perceptions of corruption
Overall rank 1.000000 -0.989096 -0.801947 -0.767465 -0.787411 -0.546606 -0.047993 -0.351959
Score -0.989096 1.000000 0.793883 0.777058 0.779883 0.566742 0.075824 0.385613
GDP per capita -0.801947 0.793883 1.000000 0.754906 0.835462 0.379079 -0.079662 0.298920
Social support -0.767465 0.777058 0.754906 1.000000 0.719009 0.447333 -0.048126 0.181899
Healthy life expectancy -0.787411 0.779883 0.835462 0.719009 1.000000 0.390395 -0.029511 0.295283
Freedom to make life choices -0.546606 0.566742 0.379079 0.447333 0.390395 1.000000 0.269742 0.438843
Generosity -0.047993 0.075824 -0.079662 -0.048126 -0.029511 0.269742 1.000000 0.326538
Perceptions of corruption -0.351959 0.385613 0.298920 0.181899 0.295283 0.438843 0.326538 1.000000
In [8]:
Overall rankScoreGDP per capitaSocial supportHealthy life expectancyFreedom to make life choicesGenerosityPerceptions of corruptionPerceptions of corruptionGenerosityFreedom to make life choicesHealthy life expectancySocial supportGDP per capitaScoreOverall rank
−0.500.51
In [14]:
Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x20012e32c88>

TASK #6: PERFORM DATA VISUALIZATION: SCATTERPLOTS AND BUBBLE CHARTS

In [15]:
FinlandDenmarkNorwayIcelandNetherlandsSwitzerlandSwedenNew ZealandCanadaAustriaAustraliaCosta RicaIsraelLuxembourgUnited KingdomIrelandGermanyBelgiumUnited StatesCzech RepublicUnited Arab EmiratesMaltaMexicoFranceTaiwanChileGuatemalaSaudi ArabiaQatarSpainPanamaBrazilUruguaySingaporeEl SalvadorItalyBahrainSlovakiaTrinidad & TobagoPolandUzbekistanLithuaniaColombiaSloveniaNicaraguaKosovoArgentinaRomaniaCyprusEcuadorKuwaitThailandLatviaSouth KoreaEstoniaJamaicaMauritiusJapanHondurasKazakhstanBoliviaHungaryParaguayNorthern CyprusPeruPortugalPakistanRussiaPhilippinesSerbiaMoldovaLibyaMontenegroTajikistanCroatiaHong KongDominican RepublicBosnia and HerzegovinaTurkeyMalaysiaBelarusGreeceMongoliaNorth MacedoniaNigeriaKyrgyzstanTurkmenistanAlgeriaMoroccoAzerbaijanLebanonIndonesiaChinaVietnamBhutanCameroonBulgariaGhanaIvory CoastNepalJordanBeninCongo (Brazzaville)GabonLaosSouth AfricaAlbaniaVenezuelaCambodiaPalestinian TerritoriesSenegalSomaliaNamibiaNigerBurkina FasoArmeniaIranGuineaGeorgiaGambiaKenyaMauritaniaMozambiqueTunisiaBangladeshIraqCongo (Kinshasa)MaliSierra LeoneSri LankaMyanmarChadUkraineEthiopiaSwazilandUgandaEgyptZambiaTogoIndiaLiberiaComorosMadagascarLesothoBurundiZimbabweHaitiBotswanaSyriaMalawiYemenRwandaTanzaniaAfghanistanCentral African RepublicSouth Sudan00.20.40.60.811.21.41.6345678
GDP per capitaScore
In [16]:
00.511.5345678
Country or regionFinlandDenmarkNorwayIcelandNetherlandsSwitzerlandSwedenNew ZealandCanadaAustriaAustraliaCosta RicaIsraelLuxembourgUnited KingdomIrelandGermanyBelgiumUnited StatesCzech RepublicUnited Arab EmiratesMaltaMexicoFranceTaiwanChileGuatemalaSaudi ArabiaQatarSpainPanamaBrazilUruguaySingaporeEl SalvadorItalyBahrainSlovakiaTrinidad & TobagoPolandUzbekistanLithuaniaColombiaSloveniaNicaraguaKosovoArgentinaRomaniaCyprusEcuadorKuwaitThailandLatviaSouth KoreaEstoniaJamaicaMauritiusJapanHondurasKazakhstanBoliviaHungaryParaguayNorthern CyprusPeruPortugalPakistanRussiaPhilippinesSerbiaMoldovaLibyaMontenegroTajikistanCroatiaHong KongDominican RepublicBosnia and HerzegovinaTurkeyMalaysiaBelarusGreeceMongoliaNorth MacedoniaNigeriaKyrgyzstanTurkmenistanAlgeriaMoroccoAzerbaijanLebanonIndonesiaChinaVietnamBhutanCameroonBulgariaGhanaIvory CoastNepalJordanBeninCongo (Brazzaville)GabonLaosSouth AfricaAlbaniaVenezuelaCambodiaPalestinian TerritoriesSenegalSomaliaNamibiaNigerBurkina FasoArmeniaIranGuineaGeorgiaGambiaKenyaMauritaniaMozambiqueTunisiaBangladeshIraqCongo (Kinshasa)MaliSierra LeoneSri LankaMyanmarChadUkraineEthiopiaSwazilandUgandaEgyptZambiaTogoIndiaLiberiaComorosMadagascarLesothoBurundiZimbabweHaitiBotswanaSyriaMalawiYemenRwandaTanzaniaAfghanistanCentral African RepublicSouth SudanHappiness Score vs GDP per CapitaGDP per capitaScore
In [17]:
00.10.20.30.40.50.6345678
Country or regionFinlandDenmarkNorwayIcelandNetherlandsSwitzerlandSwedenNew ZealandCanadaAustriaAustraliaCosta RicaIsraelLuxembourgUnited KingdomIrelandGermanyBelgiumUnited StatesCzech RepublicUnited Arab EmiratesMaltaMexicoFranceTaiwanChileGuatemalaSaudi ArabiaQatarSpainPanamaBrazilUruguaySingaporeEl SalvadorItalyBahrainSlovakiaTrinidad & TobagoPolandUzbekistanLithuaniaColombiaSloveniaNicaraguaKosovoArgentinaRomaniaCyprusEcuadorKuwaitThailandLatviaSouth KoreaEstoniaJamaicaMauritiusJapanHondurasKazakhstanBoliviaHungaryParaguayNorthern CyprusPeruPortugalPakistanRussiaPhilippinesSerbiaMoldovaLibyaMontenegroTajikistanCroatiaHong KongDominican RepublicBosnia and HerzegovinaTurkeyMalaysiaBelarusGreeceMongoliaNorth MacedoniaNigeriaKyrgyzstanTurkmenistanAlgeriaMoroccoAzerbaijanLebanonIndonesiaChinaVietnamBhutanCameroonBulgariaGhanaIvory CoastNepalJordanBeninCongo (Brazzaville)GabonLaosSouth AfricaAlbaniaVenezuelaCambodiaPalestinian TerritoriesSenegalSomaliaNamibiaNigerBurkina FasoArmeniaIranGuineaGeorgiaGambiaKenyaMauritaniaMozambiqueTunisiaBangladeshIraqCongo (Kinshasa)MaliSierra LeoneSri LankaMyanmarChadUkraineEthiopiaSwazilandUgandaEgyptZambiaTogoIndiaLiberiaComorosMadagascarLesothoBurundiZimbabweHaitiBotswanaSyriaMalawiYemenRwandaTanzaniaAfghanistanCentral African RepublicSouth SudanHappiness Score vs Freedom to make life choicesFreedom to make life choicesScore

FINAL CAPSTONE PROJECT

Using "cars.csv" dataset included in the guided project package, please complete the following tasks:

    1. Using Pandas, read the "cars.csv" dataset
    1. Perform exploratory data analysis
    1. Remove $ sign and comma (,) from MSRP and Invoice columns
    1. Convert MSRP and Invoice columns to integer datatypes and perform sanity check on the data
    1. Plot the scattermatrix and pairplot
    1. Plot a scatterplot between 'Horsepower' and 'MSRP' while showing 'Make' as text. Use the 'Cylinders' column to display color.
    1. Plot the wordcloud of the Make column
    1. Plot the histogram of Make and Type of the car using Plotly Express
    1. Find out which manufacturer has high number of Sports type
    1. Find out which manufacturers has Hybrids
    1. Plot the correlation matrix using plotly express and Seaborn
    1. Comment on the correlation matrix, which feature has the highest positive correlation with MSRP?
In [18]:
In [20]:
Out[20]:
Make Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway Weight Wheelbase Length
0 Acura MDX SUV Asia All $36,945 $33,337 3.5 6.0 265 17 23 4451 106 189
1 Acura RSX Type S 2dr Sedan Asia Front $23,820 $21,761 2.0 4.0 200 24 31 2778 101 172
2 Acura TSX 4dr Sedan Asia Front $26,990 $24,647 2.4 4.0 200 22 29 3230 105 183
3 Acura TL 4dr Sedan Asia Front $33,195 $30,299 3.2 6.0 270 20 28 3575 108 186
4 Acura 3.5 RL 4dr Sedan Asia Front $43,755 $39,014 3.5 6.0 225 18 24 3880 115 197
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
423 Volvo C70 LPT convertible 2dr Sedan Europe Front $40,565 $38,203 2.4 5.0 197 21 28 3450 105 186
424 Volvo C70 HPT convertible 2dr Sedan Europe Front $42,565 $40,083 2.3 5.0 242 20 26 3450 105 186
425 Volvo S80 T6 4dr Sedan Europe Front $45,210 $42,573 2.9 6.0 268 19 26 3653 110 190
426 Volvo V40 Wagon Europe Front $26,135 $24,641 1.9 4.0 170 22 29 2822 101 180
427 Volvo XC70 Wagon Europe All $35,145 $33,112 2.5 5.0 208 20 27 3823 109 186

428 rows × 15 columns

In [21]:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 428 entries, 0 to 427
Data columns (total 15 columns):
 #   Column       Non-Null Count  Dtype  
---  ------       --------------  -----  
 0   Make         428 non-null    object 
 1   Model        428 non-null    object 
 2   Type         428 non-null    object 
 3   Origin       428 non-null    object 
 4   DriveTrain   428 non-null    object 
 5   MSRP         428 non-null    object 
 6   Invoice      428 non-null    object 
 7   EngineSize   428 non-null    float64
 8   Cylinders    426 non-null    float64
 9   Horsepower   428 non-null    int64  
 10  MPG_City     428 non-null    int64  
 11  MPG_Highway  428 non-null    int64  
 12  Weight       428 non-null    int64  
 13  Wheelbase    428 non-null    int64  
 14  Length       428 non-null    int64  
dtypes: float64(2), int64(6), object(7)
memory usage: 50.3+ KB
In [22]:
Out[22]:
EngineSize Cylinders Horsepower MPG_City MPG_Highway Weight Wheelbase Length
count 428.000000 426.000000 428.000000 428.000000 428.000000 428.000000 428.000000 428.000000
mean 3.196729 5.807512 215.885514 20.060748 26.843458 3577.953271 108.154206 186.362150
std 1.108595 1.558443 71.836032 5.238218 5.741201 758.983215 8.311813 14.357991
min 1.300000 3.000000 73.000000 10.000000 12.000000 1850.000000 89.000000 143.000000
25% 2.375000 4.000000 165.000000 17.000000 24.000000 3104.000000 103.000000 178.000000
50% 3.000000 6.000000 210.000000 19.000000 26.000000 3474.500000 107.000000 187.000000
75% 3.900000 6.000000 255.000000 21.250000 29.000000 3977.750000 112.000000 194.000000
max 8.300000 12.000000 500.000000 60.000000 66.000000 7190.000000 144.000000 238.000000
In [48]:
In [49]:
Out[49]:
Make Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway Weight Wheelbase Length
0 Acura MDX SUV Asia All 36945 33337 3.5 6.0 265 17 23 4451 106 189
1 Acura RSX Type S 2dr Sedan Asia Front 23820 21761 2.0 4.0 200 24 31 2778 101 172
2 Acura TSX 4dr Sedan Asia Front 26990 24647 2.4 4.0 200 22 29 3230 105 183
3 Acura TL 4dr Sedan Asia Front 33195 30299 3.2 6.0 270 20 28 3575 108 186
4 Acura 3.5 RL 4dr Sedan Asia Front 43755 39014 3.5 6.0 225 18 24 3880 115 197
In [109]:
AcuraGMCLand RoverOldsmobileVolkswagenMDX300M Special Edition 4drXKR coupe 2drPathfinder SETundra Access Cab V6 SR5SUVSportsTruckAsiaEuropeUSAAllFrontRear050k100k150k200k050k100k150k2468510200400204060204060200040006000100120140AcuraGMCLand RoverOldsmobileVolkswagen150200MDXTown and Country LimitedOptima LX 4drQuest SPhaeton 4drSUVSportsTruckAsiaEuropeUSAAllFrontRear050k100k150k200k050k100k150k2468510200400204060204060200040006000100120140150200
MakeModelTypeOriginDriveTrainMSRPInvoiceEngineSizeCylindersHorsepowerMPG_CityMPG_HighwayWeightWheelbaseLengthMakeModelTypeOriginDriveTrainMSRPInvoiceEngineSizeCylindersHorsepowerMPG_CityMPG_HighwayWeightWheelbaseLength
In [55]:
Out[55]:
<seaborn.axisgrid.PairGrid at 0x200102935f8>
In [104]:
AcuraAcuraAcuraAcuraAcuraAcuraAcuraAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiAudiBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBMWBuickBuickBuickBuickBuickBuickBuickBuickBuickCadillacCadillacCadillacCadillacCadillacCadillacCadillacCadillacChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChevroletChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerChryslerDodgeDodgeDodgeDodgeDodgeDodgeDodgeDodgeDodgeDodgeDodgeDodgeDodgeFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordFordGMCGMCGMCGMCGMCGMCGMCGMCHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHondaHummerHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiHyundaiInfinitiInfinitiInfinitiInfinitiInfinitiInfinitiInfinitiInfinitiIsuzuIsuzuJaguarJaguarJaguarJaguarJaguarJaguarJaguarJaguarJaguarJaguarJaguarJaguarJeepJeepJeepKiaKiaKiaKiaKiaKiaKiaKiaKiaKiaKiaLand RoverLand RoverLand RoverLexusLexusLexusLexusLexusLexusLexusLexusLexusLexusLexusLincolnLincolnLincolnLincolnLincolnLincolnLincolnLincolnLincolnMINIMINIMazdaMazdaMazdaMazdaMazdaMazdaMazdaMazdaMazdaMazdaMazdaMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercedes-BenzMercuryMercuryMercuryMercuryMercuryMercuryMercuryMercuryMercuryMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiMitsubishiNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanNissanOldsmobileOldsmobileOldsmobilePontiacPontiacPontiacPontiacPontiacPontiacPontiacPontiacPontiacPontiacPontiacPorschePorschePorschePorschePorschePorschePorscheSaabSaabSaabSaabSaabSaabSaabSaturnSaturnSaturnSaturnSaturnSaturnSaturnSaturnScionScionSubaruSubaruSubaruSubaruSubaruSubaruSubaruSubaruSubaruSubaruSubaruSuzukiSuzukiSuzukiSuzukiSuzukiSuzukiSuzukiSuzukiToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaToyotaVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolkswagenVolvoVolvoVolvoVolvoVolvoVolvoVolvoVolvoVolvoVolvoVolvoVolvo100200300400500050k100k150k200k
3456789101112CylindersHorsepowerMSRP
In [68]:
Out[68]:
array(['Acura', 'Audi', 'BMW', 'Buick', 'Cadillac', 'Chevrolet',
       'Chrysler', 'Dodge', 'Ford', 'GMC', 'Honda', 'Hummer', 'Hyundai',
       'Infiniti', 'Isuzu', 'Jaguar', 'Jeep', 'Kia', 'Land Rover',
       'Lexus', 'Lincoln', 'MINI', 'Mazda', 'Mercedes-Benz', 'Mercury',
       'Mitsubishi', 'Nissan', 'Oldsmobile', 'Pontiac', 'Porsche', 'Saab',
       'Saturn', 'Scion', 'Subaru', 'Suzuki', 'Toyota', 'Volkswagen',
       'Volvo'], dtype=object)
In [73]:
AcuraAudiBMWBuickCadillacChevroletChryslerDodgeFordGMCHondaHummerHyundaiInfinitiIsuzuJaguarJeepKiaLand RoverLexusLincolnMINIMazdaMercedes-BenzMercuryMitsubishiNissanOldsmobilePontiacPorscheSaabSaturnScionSubaruSuzukiToyotaVolkswagenVolvo0510152025
Car MakersMakecount
In [93]:
HybridSUVSedanSportsWagonTruck050100150200250
MakeAcuraAudiBMWBuickCadillacChevroletChryslerDodgeFordGMCHondaHummerHyundaiInfinitiIsuzuJaguarJeepKiaLand RoverLexusLincolnMINIMazdaMercedes-BenzMercuryMitsubishiNissanOldsmobilePontiacPorscheSaabSaturnScionSubaruSuzukiToyotaVolkswagenVolvoCar ModelsTypecount
In [84]:
Out[84]:
Make Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway Weight Wheelbase Length
0 Acura MDX SUV Asia All 36945 33337 3.5 6.0 265 17 23 4451 106 189
1 Acura RSX Type S 2dr Sedan Asia Front 23820 21761 2.0 4.0 200 24 31 2778 101 172
2 Acura TSX 4dr Sedan Asia Front 26990 24647 2.4 4.0 200 22 29 3230 105 183
3 Acura TL 4dr Sedan Asia Front 33195 30299 3.2 6.0 270 20 28 3575 108 186
4 Acura 3.5 RL 4dr Sedan Asia Front 43755 39014 3.5 6.0 225 18 24 3880 115 197
In [88]:
Out[88]:
Make Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway Weight Wheelbase Length
6 Acura NSX coupe 2dr manual S Sports Asia Rear 89765 79978 3.2 6.0 290 17 24 3153 100 174
20 Audi RS 6 4dr Sports Europe Front 84600 76417 4.2 8.0 450 15 22 4024 109 191
21 Audi TT 1.8 convertible 2dr (coupe) Sports Europe Front 35940 32512 1.8 4.0 180 20 28 3131 95 159
22 Audi TT 1.8 Quattro 2dr (convertible) Sports Europe All 37390 33891 1.8 4.0 225 20 28 2921 96 159
23 Audi TT 3.2 coupe 2dr (convertible) Sports Europe All 40590 36739 3.2 6.0 250 21 29 3351 96 159
41 BMW M3 coupe 2dr Sports Europe Rear 48195 44170 3.2 6.0 333 16 24 3415 108 177
42 BMW M3 convertible 2dr Sports Europe Rear 56595 51815 3.2 6.0 333 16 23 3781 108 177
43 BMW Z4 convertible 2.5i 2dr Sports Europe Rear 33895 31065 2.5 6.0 184 20 28 2932 98 161
44 BMW Z4 convertible 3.0i 2dr Sports Europe Rear 41045 37575 3.0 6.0 225 21 29 2998 98 161
61 Cadillac XLR convertible 2dr Sports USA Rear 76200 70546 4.6 8.0 320 17 25 3647 106 178
82 Chevrolet Corvette 2dr Sports USA Rear 44535 39068 5.7 8.0 350 18 25 3246 105 180
83 Chevrolet Corvette convertible 2dr Sports USA Rear 51535 45193 5.7 8.0 350 18 25 3248 105 180
103 Chrysler Crossfire 2dr Sports USA Rear 34495 32033 3.2 6.0 215 17 25 3060 95 160
114 Dodge Viper SRT-10 convertible 2dr Sports USA Rear 81795 74451 8.3 10.0 500 12 20 3410 99 176
133 Ford Mustang 2dr (convertible) Sports USA Rear 18345 16943 3.8 6.0 193 20 29 3290 101 183
134 Ford Mustang GT Premium convertible 2dr Sports USA Rear 29380 26875 4.6 8.0 260 17 25 3347 101 183
135 Ford Thunderbird Deluxe convert w/hardtop 2d Sports USA Front 37530 34483 3.9 8.0 280 17 24 3780 107 186
165 Honda S2000 convertible 2dr Sports Asia Rear 33260 29965 2.2 4.0 240 20 25 2835 95 162
178 Hyundai Tiburon GT V6 2dr Sports Asia Front 18739 17101 2.7 6.0 172 19 26 3023 100 173
197 Jaguar XK8 coupe 2dr Sports Europe Rear 69995 63756 4.2 8.0 294 18 26 3779 102 187
198 Jaguar XK8 convertible 2dr Sports Europe Rear 74995 68306 4.2 8.0 294 18 26 3980 102 187
199 Jaguar XKR coupe 2dr Sports Europe Rear 81995 74676 4.2 8.0 390 16 23 3865 102 187
200 Jaguar XKR convertible 2dr Sports Europe Rear 86995 79226 4.2 8.0 390 16 23 4042 102 187
227 Lexus SC 430 convertible 2dr Sports Asia Rear 63200 55063 4.3 8.0 300 18 23 3840 103 178
245 Mazda MX-5 Miata convertible 2dr Sports Asia Rear 22388 20701 1.8 4.0 142 23 28 2387 89 156
246 Mazda MX-5 Miata LS convertible 2dr Sports Asia Rear 25193 23285 1.8 4.0 142 23 28 2387 89 156
247 Mazda RX-8 4dr automatic Sports Asia Rear 25700 23794 1.3 NaN 197 18 25 3053 106 174
248 Mazda RX-8 4dr manual Sports Asia Rear 27200 25179 1.3 NaN 238 18 24 3029 106 174
269 Mercedes-Benz SL500 convertible 2dr Sports Europe Rear 90520 84325 5.0 8.0 302 16 23 4065 101 179
270 Mercedes-Benz SL55 AMG 2dr Sports Europe Rear 121770 113388 5.5 8.0 493 14 21 4235 101 179
271 Mercedes-Benz SL600 convertible 2dr Sports Europe Rear 126670 117854 5.5 12.0 493 13 19 4429 101 179
272 Mercedes-Benz SLK230 convertible 2dr Sports Europe Rear 40320 37548 2.3 4.0 192 21 29 3055 95 158
273 Mercedes-Benz SLK32 AMG 2dr Sports Europe Rear 56170 52289 3.2 6.0 349 17 22 3220 95 158
295 Mitsubishi Eclipse GTS 2dr Sports Asia Front 25092 23456 3.0 6.0 210 21 28 3241 101 177
296 Mitsubishi Eclipse Spyder GT convertible 2dr Sports Asia Front 26992 25218 3.0 6.0 210 21 28 3296 101 177
297 Mitsubishi Lancer Evolution 4dr Sports Asia Front 29562 27466 2.0 4.0 271 18 26 3263 103 179
311 Nissan 350Z coupe 2dr Sports Asia Rear 26910 25203 3.5 6.0 287 20 26 3188 104 169
312 Nissan 350Z Enthusiast convertible 2dr Sports Asia Rear 34390 31845 3.5 6.0 287 20 26 3428 104 169
328 Pontiac GTO 2dr Sports USA Rear 33500 30710 5.7 8.0 340 16 20 3725 110 190
331 Porsche 911 Carrera convertible 2dr (coupe) Sports Europe Rear 79165 69229 3.6 6.0 315 18 26 3135 93 175
332 Porsche 911 Carrera 4S coupe 2dr (convert) Sports Europe All 84165 72206 3.6 6.0 315 17 24 3240 93 175
333 Porsche 911 Targa coupe 2dr Sports Europe Rear 76765 67128 3.6 6.0 315 18 26 3119 93 175
334 Porsche 911 GT2 2dr Sports Europe Rear 192465 173560 3.6 6.0 477 17 24 3131 93 175
335 Porsche Boxster convertible 2dr Sports Europe Rear 43365 37886 2.7 6.0 228 20 29 2811 95 170
336 Porsche Boxster S convertible 2dr Sports Europe Rear 52365 45766 3.2 6.0 258 18 26 2911 95 170
360 Subaru Impreza WRX 4dr Sports Asia All 25045 23022 2.0 4.0 227 20 27 3085 99 174
361 Subaru Impreza WRX STi 4dr Sports Asia All 31545 29130 2.5 4.0 300 18 24 3263 100 174
395 Toyota Celica GT-S 2dr Sports Asia Front 22570 20363 1.8 4.0 180 24 33 2500 102 171
396 Toyota MR2 Spyder convertible 2dr Sports Asia Rear 25130 22787 1.8 4.0 138 26 32 2195 97 153
In [97]:
MSRPInvoiceEngineSizeCylindersHorsepowerMPG_CityMPG_HighwayWeightWheelbaseLengthLengthWheelbaseWeightMPG_HighwayMPG_CityHorsepowerCylindersEngineSizeInvoiceMSRP
−0.6−0.4−0.200.20.40.60.81
In [103]:
Out[103]:
<matplotlib.axes._subplots.AxesSubplot at 0x2001701d9e8>
In [ ]:
In [ ]:
In [ ]:

PRACTICE OPPORTUNITIES SOLUTIONS

PRACTICE OPPORTUNITY #1 SOLUTION:

  • Select 2 countries from the dataframe and explore scores. Perform sanity check.
In [ ]:
In [ ]:

PRACTICE OPPORTUNITY #2 SOLUTION:

  • Which country has the maximum happiness score? What is the perception of corruption in this country?
In [ ]:
In [ ]:
In [ ]:

FINAL CAPSTONE PROJECT SOLUTION

In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:

EXCELLENT JOB!